package com.xxxx.yygh.task.scheduled;


import com.xxxx.yygh.mq.constant.MqConst;
import com.xxxx.yygh.mq.service.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling // 定时任务
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    /**cron表达式，设置执行间隔
     * 每天8点执行 提醒就诊： 0 0 8 * * ？  (注意第7位要删掉，不用，6位就可以了)
     */
    @Scheduled(cron = "0 0 8 * * ?")
    public void taskPatient(){
        System.out.println("发送了");
        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK, MqConst.ROUTING_TASK_8,"8888");
    }
}
